package com.ssy.lingxi.report.api.enums;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 采购订单操作类型枚举
 * @author 伍将
 * @date 2020/11/18
 * @version 2.0.0
 */
public enum PurchaseOrderOperateTypeEnum {

    /**
     * 待提交审核订单
     */
    TO_BE_VALIFY_COMMIT(1, "待提交审核订单", "/memberCenter/order/purchaseOrder/readyAddCashOrder"),
    /**
     * 待审核订单（一级）
     */
    TO_BE_VALIFY_STEP1(2, "待审核订单（一级）", "/memberCenter/order/purchaseOrder/firstApprovedOrder"),
    /**
     * 待审核订单（二级）
     */
    TO_BE_VALIFY_STEP2(3, "待审核订单（二级）", "/memberCenter/order/purchaseOrder/secondApprovedOrder"),
    /**
     * 待提交订单
     */
    TO_BE_COMMIT(4, "待确认订单", "/memberCenter/order/purchaseOrder/readySubmitOrder"),
    /**
     * 待确认电子合同订单
     */
    TO_BE_CONFIRM_CONTRACT(5, "待确认电子合同订单", "/memberCenter/order/purchaseOrder/readyConfirmContract"),
    /**
     * 待支付订单
     */
    TO_BE_PAY(6, "待支付订单", "/memberCenter/order/purchaseOrder/readyPayOrder"),
    /**
     * 待新增采购入库单订单
     */
    TO_BE_ADD_STORAGE(7, "待新增采购入库单订单", "/memberCenter/order/purchaseOrder/addPurchaseWarehouseOrder"),
    /**
     * 待确认收货订单
     */
    TO_BE_CONFIRM_RECEIVE_GOODS(8, "待确认收货订单", "/memberCenter/order/purchaseOrder/readyReceiveOrder"),
    /**
     * 待归档订单
     */
    TO_BE_ARCHIVE(9, "待归档订单", "/memberCenter/order/purchaseOrder/readyFileOrder"),
    /**
     * 待评价订单
     */
    TO_BE_EVALUATE(10, "待评价订单", "/memberCenter/order/purchaserEvaluation/unevaluated");

    /**
     * 编码
     */
    private final Integer code;
    /**
     * 名称
     */
    private final String name;
    /**
     * 链接
     */
    private final String link;


    PurchaseOrderOperateTypeEnum(Integer code, String name, String link) {
        this.code = code;
        this.name = name;
        this.link = link;
    }

    public static PurchaseOrderOperateTypeEnum getEnum(Integer code) {
        return Arrays.stream(PurchaseOrderOperateTypeEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }


    public Integer getCode() {
        return code;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public String getLink() {
        return link;
    }
}
